#ifndef __AR1020_H
#define __AR1020_H

#include "Includes.h"

void init_SPI1(void);
uint8_t SPI1_send(uint8_t data);
void Configure_PD0(void);
void InterByteDelay(void);
void CSDelay(void);
void ActiveCS(void);
void DeActiveCS(void);
void ReceivePacket(uint8_t *buffer);
void SendPacket(uint8_t *buffer);

typedef struct Packet
{
	uint8_t Reserve:7;
	uint8_t Pen:1;
	uint16_t X:12;
	uint16_t Y:12;
}sPacket;

typedef union Buffer
{
	sPacket pak;
	uint8_t buffer[5];
}uBuffer;

typedef struct AR1020
{
	uBuffer buffer;
	uint8_t NbBytes;
}AR1020_Packet;

#endif /* AR1020_H */
